/*
 * GbtType.h
 *
 *  Created on: 2018年2月1日
 *      Author: terry
 */

#ifndef GBTTYPE_H_
#define GBTTYPE_H_

#include "GbtConfig.h"

#ifdef __cplusplus
extern "C" {
#endif
///////////////////////////////////////////////////////////////////

#define GBT_NAME_LENGTH         128
#define GBT_UNICODE_LENGTH      20
#define GBT_IP_LENGTH           64
#define GBT_TIME_LENGTH         64
#define GBT_MAX_DEVICE          64
#define GBT_MAX_ALARM_DEVICE    32
#define GBT_PATH_LENGTH         512
#define GBT_MESSAGE_LENGTH      4096

#define GBT_DESC_LENGTH         1024


#define GBT_MAX_ALARM_COUNT     64
#define GBT_MAX_RECORD_COUNT    64

#define GBT_MAX_ITEM_COUNT      32

#define GBT_PTZ_CONTROL_LENGTH  16


typedef enum GBT_Version
{
	GBT_VERSION_2011 = 2011,
	GBT_VERSION_2016 = 2016
} GBT_Version;

typedef enum GBT_Const
{
    GBT_HEARTBEAT_INTERVAL = 30,    /// 心跳间隔.
    GBT_HEARTBEAT_COUNT = 3,    /// 心跳超时次数.
    GBT_REG_CYCLE = 3600,         /// 注册刷新周期, 单位为秒.
    GBT_REG_RETRY_TIME = 10,        /// 注册失败后重试间隔, 单位为秒.

    GBT_CONTROL_PRIORITY = 5, // ptz
    GBT_MOBILEPOSITION_INTERVAL = 5,    /// 秒.
} GBT_Const;


typedef enum GBT_ResultType
{
	GBT_RESULT_ERROR = 0,
	GBT_RESULT_OK = 1
} GBT_ResultType;


typedef enum GBT_DeviceType
{
    GBT_DEVICE_UNKNOWN      = 100,

    GBT_DEVICE_FRONT_DEVICE    = 110,		/// 111 - 199
    GBT_DEVICE_AUDIOOUT = 137,

    GBT_DEVICE_SERVER = 200,

    GBT_DEVICE_CENTER_SERVER   = 200,
	GBT_DEVICE_WEB_SERVER,
	GBT_DEVICE_RELAY_SERVER,
	GBT_DEVICE_PROXY_SERVER,
	GBT_DEVICE_SECURITY_SERVER,
	GBT_DEVICE_ALARM_SERVER,
	GBT_DEVICE_DATABASE_SERVER,
	GBT_DEVICE_GIS_SERVER,
	GBT_DEVICE_MANAGER_SERVER,
	GBT_DEVICE_GATE_SERVER,
	GBT_DEVICE_RECORD_SERVER   = 210,

	GBT_DEVICE_USER            = 300,
	GBT_DEVICE_TERMINAL_USER   = 400,

	GBT_DEVICE_OUTER = 500,
	GBT_DEVICE_EXT = 600

} GBT_DeviceType;


typedef enum GBT_StreamOperation
{
    GBT_OPERATION_NONE = 0,
    GBT_OPERATION_PLAY  = 1,
    GBT_OPERATION_PLAYBACK,
    GBT_OPERATION_DOWNLOAD,
    GBT_OPERATION_TALK
} GBT_StreamOperation;


typedef enum GBT_StreamType
{
    GBT_STREAM_LIVE     = 0,
    GBT_STREAM_RECORD   = 1
} GBT_StreamType;


typedef enum GBT_Online
{
    GBT_OFFLINE = 0,
    GBT_ONLINE = 1
} GBT_Online;


typedef enum GBT_Status
{
    GBT_STATUS_OFF = 0,
    GBT_STATUS_ON = 1
} GBT_Status;

typedef enum GBT_OnOff
{
    GBT_OFF = 0,
    GBT_ON = 1
} GBT_OnOff;

typedef enum GBT_DutyStatus
{
    GBT_OFFDUTY = 0,
    GBT_ONDUTY
} GBT_DutyStatus;

typedef enum GBT_CommandType
{
    GBT_COMMAND_NONE = 0,
    GBT_COMMAND_CONTROL,
    GBT_COMMAND_QUERY,
    GBT_COMMAND_NOTIFY,
    GBT_COMMAND_RESPONSE
} GBT_CommandType;


typedef enum GBT_RecordType
{
    GBT_RECORD_TIME     = 0x01,
    GBT_RECORD_ALARM    = 0x02,
    GBT_RECORD_MANUAL   = 0x04,
    GBT_RECORD_ALL  = 0xFF
} GBT_RecordType;





typedef enum GBT_AlarmPriority
{
	/// 0为全部，1为一级警情，2为二级警情，3为三级警情，4为四级警情.
	GBT_ALARM_PRIORITY = 0,

	GBT_ALARM_PRIORITY1 = 1,
	GBT_ALARM_PRIORITY2,
	GBT_ALARM_PRIORITY3,
	GBT_ALARM_PRIORITY4
} GBT_AlarmPriority;


typedef enum GBT_AlarmMethod
{
	/// 0为全部，1为电话报警，2为设备报警，3为短信报警，4为GPS报警，5为视频报警，6为设备故障报警，7其他报警.
	/// 可以为直接组合如12为电话报警或设备报警.

	GBT_ALARM_ALL = '0',

	GBT_ALARM_NONE = 0,

	GBT_ALARM_TELE = 1,
	GBT_ALARM_DEVICE = 2,
	GBT_ALARM_SMS,
	GBT_ALARM_GPS,
	GBT_ALARM_VIDEO,
	GBT_ALARM_FAULT,

	GBT_ALARM_OTHER,

	GBT_ALARM_MAX_METHOD = 10
} GBT_AlarmMethod;

/*
 * 报警方式为2时，不携带AlarmType为默认的报警设备报警，携带AlarmType取值及对应报警类型如下：
 * 1-视频丢失报警；2-设备防拆报警；3-存储设备磁盘满报警；4-设备高温报警；5-设备低温报警.
 * 报警方式为5时，取值如下：1-人工视频报警；2-运动目标检测报警；3-遗留物检测报警.
 * 4-物体移除检测报警；5-绊线检测报警；6-入侵检测报警；7-逆行检测报警；8-徘徊检测报警；9-流量统计报警；10-密度检测报警；11-视频异常检测报警；12-快速移动报警.
 * 报警方式为6时，取值如下：1-存储设备磁盘故障报警；2-存储设备风扇故障报警.
 */
typedef enum GBT_AlarmType
{
    GBT_ALARM_TYPE_NONE = 0,

    /// 设备报警.
	GBT_ALARM_TYPE_VIDEOLOST 	= 1,
	GBT_ALARM_TYPE_ANTITAMPER = 2,
	GBT_ALARM_TYPE_DISKFULL,
	GBT_ALARM_TYPE_HIGHTEMPERATURE,
	GBT_ALARM_TYPE_LOWTEMPERATURE,

	/// 视频报警.
	GBT_ALARM_TYPE_MANULVIDEOALARM = 1,
	GBT_ALARM_TYPE_MOTIONDETECT = 2,
	GBT_ALARM_TYPE_REMNANT = 3,
	GBT_ALARM_TYPE_REMOVE_BODY,
	GBT_ALARM_TYPE_TRIPWIRE,
	GBT_ALARM_TYPE_INVADE,
	GBT_ALARM_TYPE_RETROGRADE,
	GBT_ALARM_TYPE_WANDER,
	GBT_ALARM_TYPE_FLOW_STATISTICS,
	GBT_ALARM_TYPE_DENSITY,
	GBT_ALARM_TYPE_EXCEPTION,
	GBT_ALARM_TYPE_FAST_MOVING,

	/// 故障报警.
	GBT_ALARM_TYPE_STORAGEFAULT = 1,
	GBT_ALARM_TYPE_STORAGEFAN = 2

} GBT_AlarmType;


/**
 * 入侵检测事件类型取值：1-进入区域；2-离开区域.
 */
typedef enum GBT_EventType
{
    GBT_ENTER_REGION = 1,
    GBT_LEAVE_REGION = 2
} GBT_EventType;


/**
 * 信令安全模式. 0：不采用；2：S/MIME签名方式；3：S/MIME加密签名同时采用方式；4：数字摘要方式.
 */
typedef enum GBT_SafetyWay
{

} GBT_SafetyWay;

/**
 * 注册方式（必选）缺省为1； 1： 符合IETF RFC 3261标准的认证注册模式；2： 基于口令的双向认证注册模式；3： 基于数字证书的双向认证注册模式.
 */
typedef enum GBT_RegisterWay
{

} GBT_RegisterWay;

/**
 * 摄像机类型扩展，标识摄像机类型：1-球机；2-半球；3-固定枪机；4-遥控枪机.
 */
typedef enum GBT_PTZType
{

} GBT_PTZType;

/**
 * 摄像机位置类型扩展。1-省际检查站、2-党政机关、3-车站码头、4-中心广场、5-体育场馆、6-商业中心、7-宗教场所、8-校园周边、9-治安复杂区域、10-交通干线.
 */
typedef enum GBT_PositionType
{

} GBT_PositionType;

/**
 * 摄像机安装位置室外、室内属性。1-室外、2-室内.
 */
typedef enum GBT_RoomType
{

} GBT_RoomType;

/**
 * 摄像机用途属性。1-治安、2-交通、3-重点.
 */
typedef enum GBT_UseType
{

} GBT_UseType;

/**
 * 摄像机补光属性。1-无补光、2-红外补光、3-白光补光.
 */
typedef enum GBT_SupplyLightType
{

} GBT_SupplyLightType;

/**
 * 摄像机监视方位属性。1-东、2-西、3-南、4-北、5-东南、6-东北、7-西南、8-西北.
 */
typedef enum GBT_DirectionType
{

} GBT_DirectionType;




typedef struct GBT_Server
{
    char ip[GBT_IP_LENGTH];
    int port;
    char id[GBT_UNICODE_LENGTH+1];  /// 服务器ID.
    char username[GBT_NAME_LENGTH]; /// 用户名, 统一编码.
    char password[GBT_NAME_LENGTH]; /// 密码.

} GBT_Server;

typedef struct GBT_AutioFormat
{
    int codec;
    int channels;
    int samplerate;

} GBT_AutioFormat;


typedef struct GBT_Catalog
{
    char deviceID[GBT_UNICODE_LENGTH+1];
    char name[GBT_NAME_LENGTH];
    char manufacturer[GBT_NAME_LENGTH];     /// 设备厂商.
    char model[GBT_NAME_LENGTH];            /// 型号.
    char owner[GBT_NAME_LENGTH];            /// 设备归属.
    char civilCode[GBT_NAME_LENGTH];        /// 行政区域.
    char block[GBT_NAME_LENGTH];            /// 警区.

    char address[GBT_NAME_LENGTH];
    int parental;
    char parentID[GBT_UNICODE_LENGTH+1];

    char ip[GBT_IP_LENGTH];
    uint16_t    port;
    char password[GBT_NAME_LENGTH];
    int     status;
    double  longitude;
    double  latitude;

    char groupID[GBT_NAME_LENGTH];  /// 业务分组ID.

} GBT_Catalog;


typedef struct GBT_Catalogs
{
    int sum;
    int size;
    GBT_Catalog items[GBT_MAX_ITEM_COUNT];
} GBT_Catalogs;


typedef struct GBT_Command
{
    int type;       /// @see GBT_CommandType
    char cmdType[GBT_NAME_LENGTH];
    char deviceID[GBT_UNICODE_LENGTH+1];
    int sn;

    char subType[GBT_NAME_LENGTH];

    int length;
    const char* content;
} GBT_Command;


typedef struct GBT_Result
{
    int result;
} GBT_Result;


typedef struct GBT_Keepalive
{
    int status;
} GBT_Keepalive;


typedef enum GBT_PtzConst
{
    GBT_PTZ_MAGIC = 0xA5

} GBT_PtzConst;

typedef enum GBT_PresetIndex
{
    GBT_MIN_PRESET = 0,
    GBT_MAX_PRESET = 255
} GBT_PresetIndex;


typedef enum GBT_DeviceDirective
{
    GBT_DIRECTIVE_STOP = 0x00,

    GBT_DIRECTIVE_RIGHT = 0x01,     /// data1 表示垂直方向速度.
    GBT_DIRECTIVE_LEFT = 0x02,

    GBT_DIRECTIVE_DOWN = 0x04,      /// data2 表示水平方向速度.
    GBT_DIRECTIVE_UP = 0x08,

	GBT_DIRECTIVE_UP_RIGHT = GBT_DIRECTIVE_UP + GBT_DIRECTIVE_RIGHT,
	GBT_DIRECTIVE_UP_LEFT = GBT_DIRECTIVE_UP + GBT_DIRECTIVE_LEFT,
	GBT_DIRECTIVE_DOWN_RIGHT = GBT_DIRECTIVE_DOWN + GBT_DIRECTIVE_RIGHT,
	GBT_DIRECTIVE_DOWN_LEFT = GBT_DIRECTIVE_DOWN + GBT_DIRECTIVE_LEFT,

    GBT_DIRECTIVE_ZOOM_IN = 0x10,   /// data3 表示变倍数.
    GBT_DIRECTIVE_ZOOM_OUT = 0x20,

    GBT_DIRECTIVE_FI_STOP = 0x40,

    GBT_DIRECTIVE_FOCUS_FAR = 0x41,     /// data1 表示 focus 数值.
    GBT_DIRECTIVE_FOCUS_NEAR = 0x42,

    GBT_DIRECTIVE_IRIS_LARGE = 0x44,    /// data2 表示iris数值.
    GBT_DIRECTIVE_IRIS_SMALL = 0x48,

    GBT_DIRECTIVE_PRESET_SET  = 0x81,   /// data2 表示预置位编号.
    GBT_DIRECTIVE_PRESET_GOTO = 0x82,
    GBT_DIRECTIVE_PRESET_DEL  = 0x83,

    GBT_DIRECTIVE_CRUISE_SET  = 0x84,   /// data1 表示巡航组号, data2 表示预置位编号.
    GBT_DIRECTIVE_CRUISE_DEL  = 0x85,
    GBT_DIRECTIVE_CRUISE_SPEED = 0x86,
    GBT_DIRECTIVE_CRUISE_STAY  = 0x87,
    GBT_DIRECTIVE_CRUISE_START = 0x88,

    GBT_DIRECTIVE_SCAN        = 0x89,   /// data1 表示组号, data2 表示子命令.
    GBT_DIRECTIVE_SCAN_SPEED  = 0x8A,   /// data1 表示组号, data2 表示速度.

    GBT_DIRECTIVE_AUX_OPEN    =  0x8C,  /// data1 表示辅助编号, 1 = 雨刷.
    GBT_DIRECTIVE_AUX_CLOSE   =  0x8D

} GBT_DeviceDirective;


typedef enum GBT_DeviceDirectiveScan
{
    GBT_DIRECTIVE_SCAN_START  = 0,  /// 开始.
    GBT_DIRECTIVE_SCAN_LEFT   = 1,  /// 左边界.
    GBT_DIRECTIVE_SCAN_RIGHT  = 2   /// 右边界.

} GBT_DeviceDirectiveScan;


#pragma pack(1)

typedef struct GBT_PtzControl
{
    uint8_t  magic;     /// 魔数.
    uint8_t  code;      /// 组合码.
    uint8_t  addr;      /// 地址.
    uint8_t  directive; /// 指令.
    uint8_t data1;      /// 数据.
    uint8_t data2;  /// 数据2.
    uint8_t data3:4;  /// 数据3.
    uint8_t addr2:4;  /// 地址2.
    uint8_t crc;    /// 校验码.
} GBT_PtzControl;

typedef struct GBT_PtzDirective
{
    uint8_t :2;
    uint8_t zoomOut:1;
    uint8_t zoomIn:1;

    uint8_t up:1;
    uint8_t down:1;
    uint8_t left:1;
    uint8_t right:1;
} GBT_PtzDirective;

typedef struct GBT_FiDirective
{
    uint8_t :4;

    uint8_t irisSmall:1;
    uint8_t irisLarge:1;
    uint8_t focusNear:1;
    uint8_t focusFar:1;
} GBT_FiDirective;

#pragma pack()


typedef struct GBT_PtzCommand
{
    GBT_PtzControl control;
    int priority;

    char name[GBT_NAME_LENGTH];     // 扩展属性, 用于表示预置位名称.
} GBT_PtzCommand;

typedef struct GBT_TeleBoot
{
    char cmd[GBT_NAME_LENGTH];
} GBT_TeleBoot;


typedef struct GBT_IFrameCmd
{
    char cmd[GBT_NAME_LENGTH];
} GBT_IFrameCmd;


typedef enum GBT_DragZoomMode
{
    GBT_DRAGZOOM_IN = 0,
    GBT_DRAGZOOM_OUT

} GBT_DragZoomMode;

typedef struct GBT_DragZoom
{
    GBT_DragZoomMode mode;

    int length;
    int width;
    int midPointX;
    int midPointY;
    int lengthX;
    int lengthY;

} GBT_DragZoom;


typedef enum GBT_RecordCmdType
{
    GBT_STOP_RECORD = 0,    /// Record
    GBT_START_RECORD        /// StopRecord

} GBT_RecordCmdType;

typedef struct GBT_RecordCmd
{
    int cmd;
} GBT_RecordCmd;


typedef struct GBT_AlarmCmd
{
    char cmd[GBT_NAME_LENGTH];  /// ResetAlarm;
} GBT_AlarmCmd;


typedef enum GBT_GuardCmdType
{
    GBT_SETGUARD = 0,    /// SetGuard
    GBT_RESETGUARD        /// ResetGuard

} GBT_GuardCmdType;

typedef struct GBT_GuardCmd
{
    int cmd;
} GBT_GuardCmd;


typedef struct GBT_HomePosition
{
    int enabled;    /// 0 = 关闭, 1= 开启.
    int resetTime;  /// 自动归位时间间隔, 单位为秒.
    int presetIndex;    /// 预置位编号, 取值: [0,255].

} GBT_HomePosition;


typedef enum GBT_VideoCodec
{
    GBT_CODEC_MPEG4 = 1,
    GBT_CODEC_H264 = 2,
    GBT_CODEC_SVAC = 3,
    GBT_CODEC_3GP = 4,
    GBT_CODEC_HEVC = 5  // custom
} GBT_VideoCodec;

typedef enum GBT_Resolution
{
    GBT_RESOLUTION_QCIF = 1,
    GBT_RESOLUTION_CIF = 2,
    GBT_RESOLUTION_4CIF = 3,
    GBT_RESOLUTION_D1 = 4,
    GBT_RESOLUTION_720P = 5,
    GBT_RESOLUTION_1080P = 6
} GBT_Resolution;

typedef enum GBT_BitrateMode
{
    GBT_BITRATE_CBR = 1,
    GBT_BITRATE_VBR = 2
} GBT_BitrateMode;

typedef enum GBT_AudioCodec
{
    GBT_CODEC_G711 = 1,
    GBT_CODEC_G723_1 = 2,
    GBT_CODEC_G729,
    GBT_CODEC_G722_1,
    GBT_CODEC_AAC = 10  // custom
} GBT_AudioCodec;

typedef enum GBT_AudioBitrate
{
    GBT_5_3kbps = 1,
    GBT_6_3kbps,
    GBT_8kbps,
    GBT_16kbps,
    GBT_24kbps,
    GBT_32kbps,
    GBT_48kbps,
    GBT_64kbps = 8
} GBT_AudioBitrate;

typedef enum GBT_SampleRate
{
    GBT_RATE_8kHz = 1,
    GBT_RATE_14kHz,
    GBT_RATE_16kHz,
    GBT_RATE_32kHz = 4
} GBT_SampleRate;


typedef enum GBT_ConfigType
{
    GBT_CONFIG_BASICPARAM    = 0x01,    /// 
    GBT_CONFIG_VIDEOPARAMOPT = 0x02,
    GBT_CONFIG_VIDEOPARAMCONFIG = 0x04,
    GBT_CONFIG_AUDIOPARAMOPT    = 0x08,
    GBT_CONFIG_AUDIOPARAMCONFIG = 0x10,
    GBT_CONFIG_SVACENCODECONFIG = 0x20,
    GBT_CONFIG_SVACDECODECONFIG = 0x40

} GBT_ConfigType;

typedef struct GBT_ConfigDownload
{
    char configType[GBT_NAME_LENGTH];

} GBT_ConfigDownload;


typedef enum GBT_PositionCapability
{
    GBT_POSITION_NONE = 0,
    GBT_POSITION_GPS = 0x01,    /// GBS 定位.
    GBT_POSITION_BEIDOU = 0x02  /// 北斗定位.
} GBT_PositionCapability;


typedef struct GBT_BasicParam
{
    char name[GBT_NAME_LENGTH];         /// 名称.

    char deviceID[GBT_UNICODE_LENGTH + 1];
    char serverID[GBT_UNICODE_LENGTH + 1];
    char serverIP[GBT_IP_LENGTH];
    int  serverPort;
    char domainName[GBT_NAME_LENGTH];

    int expiration;   ///
    int heartBeatInterval;
    int heartBeatCount;

    int positionCapability;
    double longitude;
    double latitude;

} GBT_BasicParam;


typedef struct GBT_VideoParamOpt
{
    char downloadSpeed[GBT_NAME_LENGTH];
    char resolution[GBT_NAME_LENGTH];

    char format[GBT_NAME_LENGTH];
    char framerate[GBT_NAME_LENGTH];
    char bitrate[GBT_NAME_LENGTH];
    char bitrateType[GBT_NAME_LENGTH];
} GBT_VideoParamOpt;


typedef struct GBT_VideoParamConfig
{
    char name[GBT_NAME_LENGTH]; /// Stream1, Stream2, ...
    int format;
    int resolution;
    int framerate;
    int bitrate;
    int bitrateType;

} GBT_VideoParamConfig;


typedef struct GBT_AudioParamOpt
{
    char format[GBT_NAME_LENGTH];
    char bitrate[GBT_NAME_LENGTH];
    char samplerate[GBT_NAME_LENGTH];
} GBT_AudioParamOpt;


typedef struct GBT_AudioParamConfig
{
    char name[GBT_NAME_LENGTH]; /// Stream1, Stream2, ...
    int format;
    int bitrate;
    int samplerate;
} GBT_AudioParamConfig;



typedef struct GBT_DeviceConfig
{
    GBT_BasicParam          basicParam;
    GBT_VideoParamConfig    videoParam;
} GBT_DeviceConfig;


typedef struct GBT_CatalogQuery
{
    char deviceID[GBT_UNICODE_LENGTH+1];
    int64_t startTime;
    int64_t endTime;

} GBT_CatalogQuery;

typedef struct GBT_DeviceInfo
{
    char name[GBT_NAME_LENGTH];         /// 设备名称.
    char manufacturer[GBT_NAME_LENGTH]; /// 厂商.
    char model[GBT_NAME_LENGTH];        /// 型号.
    char firmware[GBT_NAME_LENGTH];     /// 固件.
    int channel;    /// 视频输入通道数.
} GBT_DeviceInfo;


typedef struct GBT_DeviceStatus
{
    int online;
    int status;
    int encode;
    int record;
    int64_t deviceTime;

    struct AlarmStatus
    {
        char deviceID[GBT_UNICODE_LENGTH+1];
        int dutyStatus;
    } alarmStatus[GBT_MAX_ALARM_DEVICE];

    int alarmCount;

} GBT_DeviceStatus;


typedef struct GBT_Preset
{
    int id;
    char name[GBT_NAME_LENGTH];
} GBT_Preset;

typedef struct GBT_Presets
{
    int sum;
    int size;
    GBT_Preset  items[GBT_MAX_PRESET];
} GBT_Presets;

typedef struct GBT_PresetQuery
{
    char deviceID[GBT_UNICODE_LENGTH+1];
} GBT_PresetQuery;


typedef struct GBT_AlarmQuery
{
    char deviceID[GBT_UNICODE_LENGTH+1];
    int startAlarmPriority;
    int endAlarmPriority;
    char alarmMethod[GBT_NAME_LENGTH];
    char alarmType[GBT_NAME_LENGTH];
    int64_t startAlarmTime;
    int64_t endAlarmTime;
} GBT_AlarmQuery;


typedef struct GBT_Alarm
{
    char deviceID[GBT_UNICODE_LENGTH+1];
    int alarmPriority;

    int alarmMethod;
    int64_t alarmTime;

    double longitude;
    double latitude;

    /// 报警类型.
    int alarmType;

    /// 报警类型扩展参数.
    char alarmTypeParam[GBT_PATH_LENGTH];

    char description[GBT_DESC_LENGTH];      /// 报警描述.

} GBT_Alarm;


typedef struct GBT_Alarms
{
    int sum;
    int size;
    GBT_Alarm items[GBT_MAX_ITEM_COUNT];
} GBT_Alarms;


typedef struct GBT_RecordInfoQuery
{
    char deviceID[GBT_UNICODE_LENGTH+1];

    int64_t startTime;
    int64_t endTime;

    char filepath[GBT_PATH_LENGTH];

    char address[GBT_NAME_LENGTH];
    int secrecy;
    int type;   /// 录像产生的类型.
    char recorderID[GBT_NAME_LENGTH];
    char indistinctQuery[GBT_NAME_LENGTH];

} GBT_RecordInfoQuery;


typedef struct GBT_RecordInfo
{
    char deviceID[GBT_UNICODE_LENGTH+1];    /// 设备ID.
    char name[GBT_NAME_LENGTH];             /// 文件名.

    int64_t startTime;       /// 开始时间.
    int64_t endTime;         /// 结束时间.

    char filepath[GBT_PATH_LENGTH];     /// 文件路径.

    char address[GBT_NAME_LENGTH];      /// 地址.

    int secrecy;
    int type;   /// 录像产生的类型.

    char recorderID[GBT_NAME_LENGTH];   /// 记录者ID
    char url[GBT_PATH_LENGTH];          /// 文件URL.

} GBT_RecordInfo;


typedef struct GBT_RecordInfos
{
    int sum;
    int size;
    GBT_RecordInfo items[GBT_MAX_ITEM_COUNT];
} GBT_RecordInfos;


typedef struct GBT_RecordUrl
{
    char deviceID[GBT_UNICODE_LENGTH + 1];    /// 设备ID.

    int64_t startTime;       /// 开始时间.
    int64_t endTime;         /// 结束时间.

    char url[GBT_PATH_LENGTH];          /// 文件URL.

} GBT_RecordUrl;


typedef struct GBT_MobilePositionQuery
{
    char deviceID[GBT_UNICODE_LENGTH+1];
    int interval;   /// 上报间隔, 单位：秒，默认值5.
} GBT_MobilePositionQuery;


typedef struct GBT_Position
{
	char deviceID[GBT_UNICODE_LENGTH+1];

    int64_t  time;
    double  longitude;      /// 经度.
    double  latitude;       /// 维度.
    double  speed;      /// 速度.
    double  direction;  /// 正北方的顺时针夹角，取值范围0-360度.
    double  altitude;   /// 海拔高度, 单位为米.

} GBT_Position;


typedef GBT_CatalogQuery GBT_SubscribeCatalogQuery;


typedef struct GBT_SubscribeAlarmQuery
{
    char deviceID[GBT_UNICODE_LENGTH+1];
    int startAlarmPriority;
    int endAlarmPriority;
    char alarmMethod[GBT_NAME_LENGTH];
    //char alarmType[GBT_NAME_LENGTH];
    int64_t startTime;
    int64_t endTime;

} GBT_SubscribeAlarmQuery;


typedef struct GBT_AlarmMethods
{
    GBT_AlarmMethod methods[GBT_ALARM_MAX_METHOD];

} GBT_AlarmMethods;


typedef struct GBT_Broadcast
{
    char sourceID[GBT_UNICODE_LENGTH+1];
    char targetID[GBT_UNICODE_LENGTH+1];

} GBT_Broadcast;


typedef struct GBT_MediaStatus
{
    char notifyType[GBT_NAME_LENGTH+1];

} GBT_MediaStatus;

typedef enum GBT_Transport
{
    GBT_TRANSPORT_UDP = 0,
    GBT_TRANSPORT_TCP

} GBT_Transport;


///////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif

#endif /* GBTTYPE_H_ */
